package com.imooc.business.core.executor.query.base.chart;//package com.imooc.business.core.executor.query.base.chart;
//
//import cn.mashang.report.modules.query.business.constant.GraphFlag;
//import cn.mashang.report.modules.query.business.constant.RealType;
//import cn.mashang.report.modules.query.helper.ChartType;
//import cn.mashang.report.modules.query.infra.repository.designer.base.ReportChartResultRespository;
//import cn.mashang.report.modules.query.infra.repository.designer.request.SupportTypeRequest;
//import cn.mashang.report.modules.query.infra.repository.designer.request.TableExecRequest;
//import cn.mashang.utils.date.DateUtil;
//import com.google.common.collect.Lists;
//import org.springframework.stereotype.Repository;
//
//import java.util.Date;
//import java.util.List;
//import java.util.Map;
//
///**
// * @Description: 应用图表
// * @Author guyuefeng
// * @Date: 2022-10-20 10:25
// */
//@Repository
//public class ReportRealChartResultRespository<K> extends ReportChartResultRespository<Date,K> {
//
//    /**
//     * 获取指标数据
//     * @author: guyuefeng
//     * @date: 2022/10/19 16:45
//     */
//    @Override
//    protected Map<Object, Map<String, Object>> getDataMap(TableExecRequest request, List<Date> dateList){
//        TableExecRequest.Chart chart = request.getChart();
//        Map<Object, Map<String, Object>> dataMap = execChartQuery(chart.getExectRequest(), request.getRuleSign(),
//                request.getIndexSigns(), chart.getPgPatten(), request.getPageSize(), request.getOffset());
//        return dataMap;
//    }
//
//
//
//    /**
//     * 获取时间
//     * @author: guyuefeng
//     * @param: request
//     * @date: 2022/10/19 16:44
//     */
//    @Override
//    protected List<Date> getOrganList(TableExecRequest request){
//        String groupId = request.getGroup().getGroupId();
//        //排除当前群组设置为示范数据的群组
//        boolean b = judgeCurrentUserDemonstrateFlag(groupId, false, request.getAppId());
//        if (b){
//            return Lists.newArrayList();
//        }
//        Date startDate = request.getStartDate();
//        Date endDate = request.getEndDate();
//
//        TableExecRequest.Chart chart = request.getChart();
//        String patten = chart.getPatten();
//
//        List<Date> dateList = Lists.newLinkedList();
//        while (startDate.compareTo(endDate) <= 0) {
//            dateList.add(startDate);
//            if (DateUtil.Md.equals(patten)) {
//                startDate = DateUtil.getAfterDate(startDate, 1);
//            } else if (DateUtil.Y.equals(patten)) {
//                startDate = DateUtil.getAfterYear(startDate, 1);
//            } else if (DateUtil.M.equals(patten)){
//                startDate = DateUtil.getAfterMonth(startDate);
//            }
//        }
//        return dateList;
//    }
//
//    @Override
//    protected Boolean supportRun(ChartType chartType) {
//        return ChartType.CHART.equals(chartType);
//    }
//
//
//    @Override
//    public Boolean supportType(SupportTypeRequest supportTypeRequest) {
//        return RealType.REAL.equals(supportTypeRequest.getRealType()) &&
//                GraphFlag.CHART.equals(supportTypeRequest.getGraphFlag());
//    }
//
//    @Override
//    protected String getFormatDate(Date date, String pattern) {
//        return DateUtil.format(date, pattern);
//    }
//}
